<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h1>测试体重</h1>
<form action="">
    <input type="text" name="w" placeholder="体重">
    <input type="text" name="h" placeholder="身高">
    <input type="button" value="测试" @click="fn()">
    <h2>测试结果:{{result}}</h2>
</form>
<!--引入vue框架-->
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>
<script>
    let v=new Vue({
        el:"form",
        data:{
            result:"无"
        },
        methods:{
            fn:function () {
                let data=new FormData(document.querySelector("form"));
                axios.post("/bmi2",data).then(function (response) {
                    v.result=response.data
                })
            }
        }
    })
</script>
</body>
</html>